/*

    This file is part of Hometree.

    Hometree is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Hometree is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with Hometree.  If not, see <http://www.gnu.org/licenses/>.

    Copyright 2011,2012 Roman Held

*/
#ifndef _HTR_CAPI_HEADER_
#define _HTR_CAPI_HEADER_

#include "htrconstants.h"

#ifdef __cplusplus
#ifndef BUILD_LIBHTREE
#warning THIS IS PROBABLY NOT FOR YOU. USE THE Cpp-API INSTEAD
#endif
extern "C" {
#endif

/********************************************************************\
                            Declarations
\********************************************************************/
struct sHtrClientHandler;
typedef struct sHtrClientHandler *sHtrClient;

struct sHtrResourceHandler;
typedef struct sHtrResourceHandler *sHtrResource;

typedef int (*fHtrResCallback)(sHtrResource s);

/********************************************************************\
                          Declaration
\********************************************************************/

// Allgemeines "Qt-Interface"
void    htrInit(int argc,char *argv[]);   // fuer QCoreApplication
int     htrSleep(int mSecs);              // fuer "processEvents"

// Client
void    htrClientCreate(sHtrClient *c);
void    htrClientConnect(sHtrClient c, char *host, int port);
void    htrClientClose(sHtrClient c);

// Resource
void    htrResStateCallback(sHtrResource r, fHtrResCallback cb);
void    htrResValueCallback(sHtrResource r, fHtrResCallback cb);
void    htrMimeDataCreate(sHtrResource *r, sHtrClient c, const char *url);
void    htrMimeDataOpen(sHtrResource r, int modes); // modes: HTR_RES_OPEN_xxxx
double  htrMimeDataDoubleValue(sHtrResource r, int *error);

#ifdef __cplusplus
} /* Extern C */
#endif

#endif 
